//
//  AppMacro.h
//  EFHealth
//
//  Created by liumadu on 14-11-28.
//  Copyright (c) 2018年 ef. All rights reserved.
//

#ifndef HHMusic_AppMacro_h
#define HHMusic_AppMacro_h

#import "EFConst.h"

// 是否为空
#define ISEMPTY(_v) (_v == nil || _v.length == 0)
//两个字符串是否相等
#define ISEqual(item1 , item2) [item1 isEqualToString:item2]

/**项目中边缘的距离**/
#define kEdgeWidth 8
#define kEdgeDoubleWidth 16
/* 圆角大小*/
#define kEdgeCornerRedius 3

#pragma mark - 颜色
/**背景色**/
#define kColorDefultBg UIColorFromRGB1(0xf7f7f7)//f1f1f1 f8f8f8
#define kColorDefultCell UIColorFromRGB1(0xffffff)
#define kColorDefultEdge UIColorFromRGB1(0xe4e0e0)//#adadad  0xe4e0e0  0xfefefef
#define kColorLine  UIColorFromRGB1(0xdddddd)

/**默认主题颜色**/
#define kColorDefult UIColorFromRGB1(0x4e8df9)//MJColor(55, 136, 244)
/**橘色**/
#define kColorOrange UIColorFromRGB1(0xfd9854)
/**绿色**/
#define kColorGreen UIColorFromRGB1(0x00bf8e)


/**最黑**/
#define kTitleColor_black UIColorFromRGB1(0x333333)
/**中等**/
#define kTitleColor_midden UIColorFromRGB1(0x666666)
/**最亮**/
#define kTitleColor_light UIColorFromRGB1(0x999999)
/**微亮**/
#define kTitleColor_mimi UIColorFromRGB1(0xd7d7d7)
/**白色**/
#define kTitleColor_white UIColorFromRGB1(0xf8f8f8)

#define kColorAlpha(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]

/*随机颜色*/
#define kColorRandom kColor(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))


// rgb颜色转换（16进制->10进制）
#define UIColorFromRGB1(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define kColor(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]

/*大字体大小*/
#define kFontVeryBig [UIFont systemFontOfSize:20]
#define kFontBig [UIFont systemFontOfSize:17]
#define kFontMidden [UIFont systemFontOfSize:15]
#define KFontSmall [UIFont systemFontOfSize:13]
#define kFontMimi [UIFont systemFontOfSize:11]

/*图片*/
#define kImage(image)      [UIImage imageNamed:image]
#define kDefaultImage      [UIImage imageNamed:@"default_empty.png"]
#define kDefaultIconUser   [UIImage imageNamed:@"default_headIcon.png"]
#define kDefaultIconDoctor [UIImage imageNamed:@"default_docIcon.png"]



#pragma mark - 宽高
//状态栏高度(包括安全区域)
#define KStatusBarHeight [StateHeight dev_statusBarHeight]
//导航栏高度
#define KNavBarHeight 44
//状态栏+导航栏的高度
#define KNavFullHeight [StateHeight dev_navigationFullHeight]
//底部导航栏高度（包括安全区）
#define KTarBarFullHeight [StateHeight dev_tabBarFullHeight]
//屏幕宽度
#define  SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width
//屏幕高度
#define  SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height
//去除状体栏的屏幕高度
#define  SCREEN_HEIGHT_EXCEPTSTATUS (SCREEN_HEIGHT - KStatusBarHeight)
//去除状体栏和顶部导航栏之后的屏幕高度
#define  SCREEN_HEIGHT_EXCEPTNAV (SCREEN_HEIGHT - KNavFullHeight)
//去除状体栏,顶部导航栏和底部工具栏之后的屏幕高度
#define  SCREEN_HEIGHT_EXCEPTNAVANDTAB (SCREEN_HEIGHT - KNavFullHeight-KTarBarFullHeight)

//ipad
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
//iPhone
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
//retain屏
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)
//屏幕的高度
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))

//4 3.5 320*480 5/5s/se 4 320*568 6/6s 4.7 375*667 6p/6ps 5.5 414*736
//iphone4
#define isIphone4 (IS_IPHONE && SCREEN_MAX_LENGTH == 480.0f)
//iPhone5
#define isIphone5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
//ihpone6
#define isIphone6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
//iPhone6Plus
#define isIphone6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)

//IOS系统版本（不能判断类似10.0.2）
#define IOS10_OR_LATER	( [[[UIDevice currentDevice] systemVersion] compare:@"10.0"] != NSOrderedDescending )
#define IOS9_OR_LATER	( [[[UIDevice currentDevice] systemVersion] compare:@"9.0"] != NSOrderedDescending )
#define IOS8_OR_LATER	( [[[UIDevice currentDevice] systemVersion] compare:@"8.0"] != NSOrderedDescending )
#define IOS7_OR_LATER	( [[[UIDevice currentDevice] systemVersion] compare:@"7.0"] != NSOrderedDescending )

#define VERSION_IOS10_OR_LATER [[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0
#define VERSION_IOS9_OR_LATER [[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0
#define VERSION_IOS8_OR_LATER [[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0
#define VERSION_IOS7_OR_LATER [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0

//去掉导航栏后的view的frame
#define TABLE_FRAME CGRectMake(0, KNavFullHeight, SCREEN_WIDTH, SCREEN_HEIGHT_EXCEPTNAV)




//IOS7以上状态栏高度
#define   TOP_DICTANCE ((SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))?20:0)


/********存储数据*********/
#define EFUserDefaults [NSUserDefaults standardUserDefaults]

#define EFUserDefaultsSetObj(obj, key) \
[EFUserDefaults setObject:obj forKey:key]; \
[EFUserDefaults synchronize];

#define EFUserDefaultsObjForKey(key) [EFUserDefaults objectForKey:key]

/******通知*****/
#define EFNotificaiotn [NSNotificationCenter defaultCenter]

#define EFNotificationAdd(kSelector,kName) [EFNotificaiotn addObserver:self selector:@selector(kSelector) name:kName object:nil];

#define EFNotificationPost(kName) [EFNotificaiotn postNotificationName:kName object:nil];

#define EFNotificationRemove(kName) [EFNotificaiotn removeObserver:self name:kName object:nil];


/***线程****/
#define queueGlobalStart dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

#define queueMainStart dispatch_async(dispatch_get_main_queue(), ^{

#define QueueStartAfterTime(time) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(time * NSEC_PER_SEC)), dispatch_get_main_queue(), ^(void){

#define queueEnd  });






#endif



































